package com.jc.oms.controller.port.h5;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.jc.business.supplierproduct.SupplierProductBusiness;
import com.jc.common.util.ExceptionUtil;
import com.jc.oms.controller.BaseController;

/***
 * 
* @version: v1.0
* @Description: 该类处理向H5惊喜商城推送订单
* @author: Administrator
* 2018年11月27日
 */
@Controller()
@RequestMapping("h5")
public class H5Controller extends BaseController{
	@Autowired
	SupplierProductBusiness supplierProductBusiness;
	
	@RequestMapping(value="/push_product" , method = RequestMethod.POST)
	public @ResponseBody  Map<String,Object> pushProduct(HttpServletRequest reqest){
		Map<String,Object> _ret = new HashMap<String, Object>();
		try {
			supplierProductBusiness.pushProducts(20);
			_ret.put("success", true);
		} catch (Exception e) {
			
			_ret.put("success", false);
			_ret.put("errorMsg", ExceptionUtil.subExceptionMessage(e, 0, 100));
			
		}
		return _ret;		
	}
	
	
	
	
	@RequestMapping(value="/push_product2" , method = RequestMethod.GET)
	public @ResponseBody Map<String,Object> pushProduct2(HttpServletRequest reqest){
		Map<String,Object> _ret = new HashMap<String, Object>();
		try {
			supplierProductBusiness.pushProducts(1);
			_ret.put("success", true);
		} catch (Exception e) {
			_ret.put("success", false);
			_ret.put("errorMsg", ExceptionUtil.subExceptionMessage(e, 0, 100));
		}
		return _ret;		
	}
	
}
